﻿using System;

using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Input;

namespace SmlEngine.UI.Input
{
    public static class InputSettings
    {
        public static PlayerIndex ControllingPlayer { get; set; }

        public static KeyMap Select { get; set; }
        public static KeyMap Cancel { get; set; }

        public static KeyMap Up { get; set; }
        public static KeyMap Down { get; set; }
        public static KeyMap Left { get; set; }
        public static KeyMap Right { get; set; }

        public static KeyMap Run { get; set; }
        public static KeyMap Jump { get; set; }

        public static void Defaults()
        {
            ControllingPlayer = PlayerIndex.One;

            Select = new KeyMap(Keys.Enter, Buttons.A);
            Cancel = new KeyMap(Keys.Escape, Buttons.B);

            Up = new KeyMap(Keys.Up, Buttons.DPadUp);
            Down = new KeyMap(Keys.Down, Buttons.DPadDown);
            Left = new KeyMap(Keys.Left, Buttons.DPadLeft);
            Right = new KeyMap(Keys.Right, Buttons.DPadRight);

            Run = new KeyMap(Keys.X, Buttons.X);
            Jump = new KeyMap(Keys.Space, Buttons.A);
        }
    }

    public class KeyMap
    {
        public Keys Key { get; set; }
        public Buttons Button { get; set; }

        public KeyMap(Keys key, Buttons button)
        {
            Key = key;
            Button = button;
        }
    }
}
